/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-03-26
 * Time: 20:05
 */
sealed class Animal permits Dog,Dog2{

}
non-sealed class Dog extends Animal{

}
non-sealed class Dog2 extends Animal{

}
public class Test {
    public static void main(String[] args) {
        var name = "zhangsan";
        var age = 10;
        //var类似与c语言中的typedef
    }
    public static void main3(String[] args) {
        int a = 1;
        int result = switch (a){
            case 1 : yield 1;
            case 2 : yield 2;
            default: yield -1;
        };
        System.out.println(result);
    }
    public static void main2(String[] args) {
        int a = 1;
        int result = switch (a){
            case 1 ->1;
            case 2 ->2;
            default -> -1;
        };
        System.out.println(result);
    }
    public static void main1(String[] args) {
        int a = 1;
        int result = 0;
        switch (a){
            case 1:
                result = 1;
                break;
            case 2:
                result = 2;
                break;
            case 3:
                result = 3;
                break;
            default:
                result = -1;
                break;
        }
        System.out.println(result);
    }
}
